from sklearn.cluster import BisectingKMeans,DBSCAN
import numpy
from matplotlib import pyplot
classifer=BisectingKMeans(n_clusters=4)
data=numpy.loadtxt('./testSet.txt')
classifer.fit(data)
labels = classifer.labels_
centroids = classifer.cluster_centers_
for i in range(4):
    cluster_data = data[labels == i]
    pyplot.scatter(cluster_data[:, 0], cluster_data[:, 1])
pyplot.savefig('./sklearn_bikmeans.jpg')
pyplot.show()